package com.suge.order.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.suge.common.query.order.SmsOrderQueryDO;
import com.suge.order.dao.SmsOrderDAO;
import com.suge.order.dao.dataobject.SmsOrderDO;

public class SmsOrderDAOImpl  extends SqlMapClientDaoSupport implements SmsOrderDAO {

	public SmsOrderDO getSmsOrderByOrderId(long orderId) {
		return (SmsOrderDO) this.getSqlMapClientTemplate().queryForObject("SmsOrder.querySmsOrderByOrderId",orderId);
	}

	public List<SmsOrderDO> getSmsOrderListByUserId(long userId) {
		@SuppressWarnings("unchecked")
		List<SmsOrderDO> smsOrdeList = this.getSqlMapClientTemplate().queryForList("SmsOrder.querySmsOrderByUserId", userId);
		return smsOrdeList;
	}

	public List<SmsOrderDO> getSmsOrderListByUserNick(String userNick) {
		@SuppressWarnings("unchecked")
		List<SmsOrderDO> smsOrdeList = this.getSqlMapClientTemplate().queryForList("SmsOrder.querySmsOrderByUserNick", userNick);
		return smsOrdeList;
	}

	public boolean updateSmsOrderStatus(SmsOrderDO smsOrderDO) {
		return this.getSqlMapClientTemplate().update("SmsOrder.updateSmsOrderStatusByOrderId", smsOrderDO)>0;
	}

	public boolean updateSmsOrderInfo(SmsOrderDO smsOrderDO) {
		return this.getSqlMapClientTemplate().update("SmsOrder.updateSmsOrderInfo", smsOrderDO)>0;
	}

	public SmsOrderDO insertSmsOrder(SmsOrderDO smsOrderDO) {
		return (SmsOrderDO) this.getSqlMapClientTemplate().insert("SmsOrder.insertSmsOrder", smsOrderDO);
	}

	public List<SmsOrderDO> getSmsOrderNeed2Send() {
		@SuppressWarnings("unchecked")
		List<SmsOrderDO> smsOrdeList = this.getSqlMapClientTemplate().queryForList("SmsOrder.querySmsOrderNeedSend");
		return smsOrdeList;
	}

	public SmsOrderDO getSmsOrderByOuterOrderId(String outOrderId) {
		return (SmsOrderDO) this.getSqlMapClientTemplate().queryForObject("SmsOrder.querySmsOrderByOuterOrderId",outOrderId);
	}

	public List<SmsOrderDO> getSmsOrderByQuery(SmsOrderQueryDO smsOrderQueryDO) {
		@SuppressWarnings("unchecked")
		List<SmsOrderDO> smsOrdeList = this.getSqlMapClientTemplate().queryForList("SmsOrder.querySmsOrderByQuery",smsOrderQueryDO);
		return smsOrdeList;
	}

	public List<SmsOrderDO> getSmsOrderListByDateAndUser(Map params) {
		// TODO Auto-generated method stub
		return null;
	}
}
